from models.Run import Run
from models.Walk import Walk
from models.Loiter import Loiter
from models.Standstill import Standstill
from segmentation.Formatter import Formatter
from Model import Evidence, TrackSegment

if __name__ == "__main__":

    myFormatter = Formatter()
    actorList = myFormatter.process_pol_tracks_from_file("pol.txt")

#    actorList = myFormatter.process_pol_tracks_from_file("pol-waitaroundID64.txt")
#    actorList = myFormatter.process_pol_tracks_from_file("pol-walkID89.txt")
#    actorList = myFormatter.process_pol_tracks_from_file("pol-walkID90.txt")
#    actorList = myFormatter.process_pol_tracks_from_file("pol-walkID103.txt")
#    actorList = myFormatter.process_pol_tracks_from_file("pol-standID103_sub.txt")
#    actorList = myFormatter.process_pol_tracks_from_file("pol-standstillID64_sub.txt")      

    myWalk = Loiter()
#    myWalk = Run()
#    myWalk = Standstill()
#    myWalk = Walk()

    print "\n\n\n\n"

    for act in actorList:
        evList = myFormatter.make_evidence_single(act)
        for ev in evList:
            # print "adding ev: ",ev
            myWalk.model.add_evidence(ev)
        # print act.locations

        print act.starttime," ",act.endtime
        ev = TrackSegment(actor = act,starttime = act.starttime,endtime = act.endtime,segtype = Evidence.MOVE_SLOW)
        ev.locations = act.locations[:]
        myWalk.model.add_evidence(ev)
        myWalk.model.evaluate_evidence()
        
        myWalk.model.print_xml(outf = "outloiter/loiter", mfiles = True)
        
#        print myWalk.model.hypotheses[0].likelihood

    print "\n\n\n added all evidence"
